package com.swind.fast.modules.app.railway.project.controller;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.swind.fast.common.api.vo.Result;
import com.swind.fast.common.system.query.QueryGenerator;
import com.swind.fast.common.util.oConvertUtils;
import com.swind.fast.modules.app.railway.project.entity.RailwayProjectTodo;
import com.swind.fast.modules.app.railway.project.service.IRailwayProjectTodoService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/app/railway/project/todo")
@Slf4j
public class RailwayProjectTodoController {

    @Autowired
    private IRailwayProjectTodoService railwayProjectTodoService;

    @GetMapping(value = "/list")
    public Result<IPage<RailwayProjectTodo>> queryPageList(RailwayProjectTodo railwayProjectTodo,
                                      @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                      @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                      HttpServletRequest req) {

        QueryWrapper<RailwayProjectTodo> queryWrapper = QueryGenerator.initQueryWrapper(railwayProjectTodo, req.getParameterMap());
        Page<RailwayProjectTodo> page = new Page<RailwayProjectTodo>(pageNo, pageSize);
        IPage<RailwayProjectTodo> pageList = railwayProjectTodoService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
}
